# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=pyminifakedns
pkgver=0.1
pkgrel=8
groups=('blackarch' 'blackarch-networking' 'blackarch-spoof')
pkgdesc='Minimal DNS server written in Python; it always replies with a 127.0.0.1 A-record.'
arch=('any')
url='http://code.activestate.com/recipes/491264/'
license=('custom:unknown')
depends=('python2')
source=("http://code.activestate.com/recipes/491264-mini-fake-dns-server/download/1")
sha512sums=('81ad67e7160c2a73dcb742d9bb0ff0de1638d79e9122277ec4f090132b9a6aa48a0ab30008b4e9603b3683986980a82001c75ef7f5a7ce12fbbb233aa68ee5d0')

prepare() {
  sed -i '1s/^/#!\/usr\/bin\/env python2\n\n/' 1
}

package() {
  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  cp --no-preserve=ownership 1 "$pkgdir/usr/share/$pkgname/$pkgname.py"

  chmod +x "$pkgdir/usr/share/$pkgname/$pkgname.py"

  ln -s "/usr/share/$pkgname/$pkgname.py" "$pkgdir/usr/bin/$pkgname"
}

